<div class="chit-chat-layer1">
    <div class="col-md-12 chit-chat-layer1-left">
        <div class="mail-toolbar clearfix">
            <div class="float-left">
                <button type="button" class="btn btn-primary" name="insert-btn">添加新员工</button>
                <div class="clearfix"></div>
            </div>
            <div class="float-right">
                <div class="btn-group m-r-sm mail-hidden-options" style="display: inline-block;">
                    <#--<div class="btn-group">-->
                        <#--<a class="btn btn-default dropdown-toggle" data-toggle="dropdown"-->
                           <#--aria-expanded="false">部门 <span class="caret"></span></a>-->
                        <#--<ul class="dropdown-menu dropdown-menu-right" role="menu">-->
                            <#--<li><a href="#">策划部门</a></li>-->
                            <#--<li><a href="#">人事部门</a></li>-->
                            <#--<li><a href="#">技术部门</a></li>-->
                        <#--</ul>-->
                    <#--</div>-->
                    <#--<div class="btn-group">-->
                        <#--<a class="btn btn-default dropdown-toggle" data-toggle="dropdown"-->
                           <#--aria-expanded="false">职位 <span class="caret"></span></a>-->
                        <#--<ul class="dropdown-menu dropdown-menu-right" role="menu">-->
                            <#--<li><a href="#">经理</a></li>-->
                            <#--<li><a href="#">副经理</a></li>-->
                            <#--<li><a href="#">技术人员</a></li>-->
                        <#--</ul>-->
                    <#--</div>-->
                    <span class="text-muted m-r-sm" style="margin-left: 5px">
                        <input type="text" placeholder="请输入查询内容" required="" id="selectContent" value="${selectContent?default("")}">
                        <button type="button" class="btn btn-primary" name="research-btn">查询</button>
                    </span>
                </div>
            </div>
        </div>
        <div class="work-progres" style="margin-top:40px;width: 1130px">
            <div class="chit-chat-heading">
                员工信息
            </div>
            <div class="table-responsive">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>员工姓名</th>
                    <th>生日</th>
                    <th>性别</th>
                    <th>电话</th>
                    <th>身份证</th>
                    <th>加入时间</th>
                    <th>离开时间</th>
                    <th>所属部门</th>
                    <th>所属职位</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
            <tbody>
            <#if pageView?exists && pageView.records?size gt 0>
                <#list pageView.records as hrmStaff>
                <tr>
                    <td class="hidden">${hrmStaff.id?default("")}</td>
                    <td><span>${(pageView.pageNow - 1)*(pageView.pageSize)?default(20) + hrmStaff_index + 1}</span></td>
                    <td>${hrmStaff.name?default("")}</td>
                    <td>${hrmStaff.birthday?date?default("")}</td>
                    <td>${hrmStaff.sex?default("")}</td>
                    <td>${hrmStaff.phone?default("")}</td>
                    <td>${hrmStaff.idcard?default("")}</td>
                    <td>${hrmStaff.joinTime?date?default("")}</td>
                    <td>${hrmStaff.leaveTime?date?default("")}</td>
                    <td>${hrmStaff.hrmApartment.name?default("")}</td>
                    <td>${hrmStaff.hrmPost.name?default("")}</td>
                    <td>${hrmStaff.remark?default("")}</td>
                    <td>
                        <button type="button" class="btn btn-sm btn-primary" name="update-btn">编辑</button>
                        <button type="button" class="btn btn-sm btn-default" name="delete-btn">删除</button>
                    </td>
                </tr>
                </tbody>
                </#list>
            </table>
            <#else>
                <div style="text-align: center;padding-top: 10px">暂无相应数据</div>
            </#if>
            </div>
        <#include "page/paging.ftl" />
        </div>
    </div>
</div>
<input type="hidden" value="/user/hrmStaffManage.html" id="pageUrl">
<div id="hrmStaffContaine">
</div>
<div id="hrmStaffAdd">
<#include "page/staffInfo_new.ftl" />
</div>
<script src="../../../js/jquery.haiwiModal.js"></script>
<script>
    $(function () {
        var updatebtn = $("button[name='update-btn']");
        updatebtn.click(function () {
            var stfid = $(this).parents("tr").children("td:nth-child(1)").text();
            $.ajax({
                type: "POST",
                url: "/user/hrmStaffId.post",
                data: {id: stfid},
                dataType: "html",
                success: function (data) {
                    $("#hrmStaffContaine").empty();
                    $("#hrmStaffContaine").append(data);
                    $.openHaiwiModal("popContainer");
                },
                error: function (error) {
                    alert(error);
                }
            })
        });

        var deletebtn = $("button[name='delete-btn']");
        deletebtn.click(function () {
            var stfid = $(this).parents("tr").children("td:nth-child(1)").text();
            $.ajax({
                type: "POST",
                url: "/user/deleteByStaffId.post",
                data: {id: stfid},
                dataType: "html",
                success: function (data) {
                    openView("/user/hrmStaffManage.html");
                },
                error: function (error) {
                    alert(error);
                }
            })
        });

		var researchbtn = $("button[name='research-btn']");
		researchbtn.click(function () {
			$.ajax({
				type: "POST",
				url: "/user/hrmStaffManage.html",
				data: {selectContent: $("#selectContent").val()},
				dataType: "html",
				success: function (data) {
					$("#hrmmanage").empty();
					$("#hrmmanage").append(data);
				},
				error: function (error) {
					alert(error);
				}
			})
		});

        var insertbtn = $("button[name='insert-btn']");
        insertbtn.click(function () {
            $.openHaiwiModal("hrmStaffAddContainer");
        });
    })
</script>